{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import gym"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def init_gym(env_name):\n",
    "    \"\"\"\n",
    "\n",
    "    :param env_name: str, OpenAI Gym environment name\n",
    "    :return: 3-tuple\n",
    "        env: ai gym environment\n",
    "        obs_dim: observation dimensions\n",
    "        act_dim: action dimensions\n",
    "    \"\"\"\n",
    "    env = gym.make(env_name)\n",
    "    obs_dim = env.observation_space.shape[0]\n",
    "    act_dim = env.action_space.shape[0]\n",
    "    obs_dim += 1\n",
    "\n",
    "    return env, obs_dim, act_dim"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "env_names = ['InvertedPendulum-v1', 'InvertedDoublePendulum-v1', 'Reacher-v1',\n",
    "       'HalfCheetah-v1', 'Swimmer-v1', 'Hopper-v1', 'Walker2d-v1', \n",
    "        'Ant-v1', 'Humanoid-v1', 'HumanoidStandup-v1']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[2017-07-22 06:35:06,733] Making new env: InvertedPendulum-v1\n",
      "[2017-07-22 06:35:06,974] Making new env: InvertedDoublePendulum-v1\n",
      "[2017-07-22 06:35:06,979] Making new env: Reacher-v1\n",
      "[2017-07-22 06:35:06,988] Making new env: HalfCheetah-v1\n",
      "[2017-07-22 06:35:06,997] Making new env: Swimmer-v1\n",
      "[2017-07-22 06:35:07,003] Making new env: Hopper-v1\n",
      "[2017-07-22 06:35:07,012] Making new env: Walker2d-v1\n",
      "[2017-07-22 06:35:07,019] Making new env: Ant-v1\n",
      "[2017-07-22 06:35:07,030] Making new env: Humanoid-v1\n",
      "[2017-07-22 06:35:07,037] Making new env: HumanoidStandup-v1\n"
     ]
    }
   ],
   "source": [
    "dims = []\n",
    "for env_name in env_names:\n",
    "    env, obs_dim, act_dim = init_gym(env_name)\n",
    "    dims.append((obs_dim, act_dim))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "InvertedPendulum-v1: obs_dim: 5, act_dim: 1\n",
      "InvertedDoublePendulum-v1: obs_dim: 12, act_dim: 1\n",
      "Reacher-v1: obs_dim: 12, act_dim: 2\n",
      "HalfCheetah-v1: obs_dim: 18, act_dim: 6\n",
      "Swimmer-v1: obs_dim: 9, act_dim: 2\n",
      "Hopper-v1: obs_dim: 12, act_dim: 3\n",
      "Walker2d-v1: obs_dim: 18, act_dim: 6\n",
      "Ant-v1: obs_dim: 112, act_dim: 8\n",
      "Humanoid-v1: obs_dim: 377, act_dim: 17\n",
      "HumanoidStandup-v1: obs_dim: 377, act_dim: 17\n"
     ]
    }
   ],
   "source": [
    "names_dims = list(zip(env_names, dims))\n",
    "for name_dim in names_dims:\n",
    "    print('{}: obs_dim: {}, act_dim: {}'.format(name_dim[0], name_dim[1][0], name_dim[1][1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
